<div class="pa clearfix">
  <div class="span-16 colborder">
    <% if !@article.nil? %>
      <p>
        &lsaquo;&lsaquo;<%= link_to 'Back to list', "/blog?category=#{@current_category.id}" %>
      </p>
      <h2>
        <%= @article.title %>
      </h2>
      <p class="c666">
        <%= @article.created_at.strftime('Posted at: %Y-%m-%d %H:%m:%S') %>
      </p>
      <hr/>
      <div class="pa-top f16 pa-bottom">
        <%= @article.content.html_safe %>
        <% if @article.previous_post || @article.next_post %>
          <hr class="dotted ma-top"/>
          <div class="clearfix c666 f10">
            <span class="left">
              <%= link_to('<< 上一篇', "/blog?category=#{@current_category.id}&article=#{@article.previous_post.id}") if @article.previous_post %>
            </span>
            <span class="right">
              <%= link_to("下一篇 >>", "/blog?category=#{@current_category.id}&article=#{@article.next_post.id}") if @article.next_post %>
            </span>
          </div>
        <% end %>
      </div>
    <% else %>
      <% if !@current_category.nil? %>
        <h3><%= @current_category.name %></h3>
      <% else %>
        <h3>所有博客文章</h3>
      <% end %>
      <hr/>
      <ul class="lh30">
        <% @articles.each do |article| %>
          <li><%= link_to article.title, "/blog?category=#{article.category.id}&article=#{article.id}" %></li>
        <% end %>
      </ul>
      <hr class="dotted"/>
      <div class="c666">
        <%= will_paginate @articles %>
      </div>
    <% end %>
  </div>
  <div class="span-5 last">
    <h3>分类</h3>
    <ul class="lh24">
      <% @categories.each do |category| %>
        <li><%= link_to category.name, "/blog?category=#{category.id}" %></li>
      <% end %>
    </ul>
  </div>
</div>